import React, { Component } from "react";
import Son from "../Son/Son";

export default class Parent extends Component {
    //创建状态
    state = {
        src: "http://api.xiaohigh.com/image/random",
    };

    render() {
        return (
            <div>
                <Son url={this.state.src} change={this.change}></Son>
            </div>
        );
    }

    change = () => {
        this.setState({
            src: 'http://api.xiaohigh.com/image/random?t='+Date.now()
        })
    }
}
